// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import Vue from "vue";
import Vuex from "vuex";
const persistPlugin = store => {
	console.log("----",state)
	// 读取状态
	let state = uni.getStorageSync('state')
	if (state) {
		store.replaceState(state)
	}

	// 监听状态变化
	store.subscribe((mutation, state) => {
		console.log("--111--",state)
		uni.setStorageSync('state', state)
	})
}

import modules from "./modules";
import getters from "./getters";

Vue.use(Vuex);
const debug = process.env.NODE_ENV !== "production";

export default new Vuex.Store({
  plugins: [persistPlugin],
  modules,
  getters,
  strict: debug
});
